{% extends '@WebsiteBundle/layout/baselayout.html.twig' %}
{% block seo_title %}
	{{ seoTitle }}
{% endblock %}
{% block seo_descr %}
	{{ seoDescr }}
{% endblock %}
{% block seo_kw %}
	{{ seoKw }}
{% endblock %}

{% block body_main %}
	{{ parent() }}
	<div class="page">
		{{ render(path('app_header', {"route":route})) }}
		<div class="page-wrapper">
			<div class="page-body">
				<div class="container-xl">
					<table class="table block-bg">
						<colgroup>
							<col width="150">
							<col width="200">
						</colgroup>
						<thead>
							<tr>
								<th>课程名称</th>
								<th>价格</th>
							</tr>
						</thead>
						<tbody>
							{% if goodsList %}
								{% for key, info in goodsList %}
									<tr>
										<td>{{ info['name'] }}</td>
										<td>
											{% if info['shopPrice'] >0 %}
												<span class="badge bg-red">¥{{ info['shopPriceView'] }}</span>
											{% else %}
												<span class="badge bg-teal">免费</span>
											{% endif %}
										</td>
									</tr>
								{% endfor %}
							{% endif %}
						</tbody>
					</table>
					{#  优惠券#}
					{% if shopPrice>0 %}
						<div class="row row-deck row-cards mb-2">
							<div class="col-lg-12">
								<div class="card">
									<div class="card-header">
										<h3 class="card-title">优惠码</h3>
									</div>
									<div class="card-body">
										<form action="{{ path("app_order_tobuy", {'id':id}) }}" method="get">
											<div class="row row-deck row-cards">
												<div class="col-lg-6"><input autocomplete="off" class="form-control" name="couponSn" type="text" value="{{ couponSn }}" placeholder="请输入优惠码"/></div>
												<div class="col-lg-6">
													<input type="hidden" name="goodsIdstr" value="{{ goodsIdstr|raw }}">
													<input class="btn btn-primary" type="submit" value="使用"/>
													{% if couponWarn %}
														<div class="invalid-feedback">{{ couponWarn }}</div>
													{% endif %}
												</div>
											</div>
										</form>
									</div>
								</div>
							</div>
						</div>
						<div class="row row-deck row-cards">
							<form action="{{ path("app_order_addbuy", {'id':id}) }}" method="POST" class="col-lg-12">
								<div class="card">
									<div class="card-header">
										<h3 class="card-title">选择支付方式</h3>
									</div>
									<div class="card-body">
										<div class="row row-deck row-cards">
											<div class="col-lg-12">
												<div class="form-selectgroup form-selectgroup-boxes d-flex flex-row">
													<label class="form-selectgroup-item flex-fill">
														<input type="radio" name="paymentType" value="1" class="form-selectgroup-input" checked>
														<div class="form-selectgroup-label d-flex align-items-center p-3">
															<div class="me-3">
																<span class="form-selectgroup-check"></span>
															</div>
															<div>
																<span class="payment payment-provider-alipay payment-xs me-2"></span>支付宝
															</div>
														</div>
													</label>
													<label class="form-selectgroup-item flex-fill">
														<input type="radio" name="paymentType" value="2" class="form-selectgroup-input">
														<div class="form-selectgroup-label d-flex align-items-center p-3">
															<div class="me-3">
																<span class="form-selectgroup-check"></span>
															</div>
															<div>
																<span class="payment payment-provider-wechat payment-xs me-2"></span>微信
															</div>
														</div>
													</label>
												</div>
											</div>
											<div class="col-lg-12">
												<div class="mb-3 row row-deck row-cards">
													<div class="col-lg-3">优惠金额：<label class="fontColorRed">-¥{{ discount }}</label>元</div>
													<div class="col-lg-3">应付金额：<label class="fontColorRed">¥{{ shopPrice }}</label>元</div>
												</div>
											</div>
											<div class="col-lg-12">
												<div class="mb-3 row row-deck row-cards">
													<label class="col-lg-3 col-form-label required">备注</label>
													<div class="col-lg-3">
														<textarea name="userNotes" placeholder="请输入备注内容" class="form-control"></textarea>
													</div>
												</div>
											</div>
											<div class="col-lg-12">
												<a href="#" style="color:#1E9FFF">阅读购买协议</a>
											</div>
										</div>

									</div>
									<div class="card-footer">
										<input type="hidden" name="_csrf_token" value="{{ csrf_token('dobuy') }}"/>
										<input type="hidden" name="couponSn" value="{{ couponSn }}"/>
										<input type="hidden" name="goodsIdstr" value="{{ goodsIdstr|raw }}">
										<button class="btn btn-primary">阅读协议并支付</button>
									</div>
								</div>
							</form>
						</div>
					{% else %}
						<div class="row row-deck row-cards">
							<div class="col-lg-12">
								<div class="card">
									<div class="card-body">
										<form action="{{ path("app_order_addbuy", {'id':id}) }}" method="POST">
											<input type="hidden" name="_csrf_token" value="{{ csrf_token('dobuy') }}"/>
											<input type="hidden" name="paymentType" value="0">
											<input type="hidden" name="couponSn" value="{{ couponSn }}"/>
											<input type="hidden" name="goodsIdstr" value="{{ goodsIdstr|raw }}">
											<button class="btn btn-primary">免费获取</button>
										</form>
									</div>
								</div>
							</div>
						</div>
					{% endif %}
				</div>
			</div>
		</div>
		{{ render(path('app_footer')) }}
	</div>
{% endblock %}
